package xyz.ymtao.components;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;

import java.util.Locale;

/**
 * @author: ymt
 * @description:
 * @date: 2021/8/19  9:55
 */
@Component
public class Example {
    private MessageSource messages;

    @Autowired
    public void setMessages(MessageSource messages) {
        this.messages = messages;
    }

    public void execute() {
        String message = this.messages.getMessage("argument.required",
                new Object [] {"userDao"}, "Required", null);
        System.out.println(message);
    }
}
